.NET string contains string[]

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-31T14:13:39Z Indexed on 2010/03/31 14:23 UTC
Read the original article Hit count: 132

Filed under:

I'm having a small issue putting together this contains statement any help would be awesome.

string betaFilePath = @"C:\resultsalpha.txt";
StringBuilder sb = new StringBuilder();
using (FileStream fs = new FileStream(betaFilePath, FileMode.Open))
using (StreamReader rdr = new StreamReader((fs)))
{
    while (!rdr.EndOfStream)
    {
        string betaFileLine = rdr.ReadLine();
        {
            string[] onlythese = {@"apple/",@"aee/",@"www/",@"blk/",@"art/",@"purp/",@"ora/",@"red/",@"brd/",@"biek/",@"biz/"};
            if (betaFileLine.Contains(onlythese))
            {
                File.AppendAllText(@"C:\testtestest.txt", betaFileLine);

            }
        }
    }

Error: Argument '1': cannot convert from 'string[]' to 'string' -> if (betaFileLine.Contains(onlythese))

© Stack Overflow or respective owner

Related posts about c#